home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d6 / glazer.arc / SIMPINV.BAS < prev    next >
BASIC Source File  |  1988-10-07  |  2KB  |  47 lines

  1. 100 'Simple Investments ("SIMPINV")
  2. 110 CLS
  3. 120 COLOR 0,15 : PRINT "Simple Investments Evaluator" : COLOR 15,0
  4. 130 DEFDBL A-Z
  5. 140 DEFINT M-N
  6. 150 'Define rounding function
  7. 160 DEF FNR (V) = SGN (V) * INT (ABS (V) * 100 + .5) / 100
  8. 170 MONEYFMT$ = "$$##,###,###.##"
  9. 180 '     Let user select result
  10. 190 PRINT
  11. 200 PRINT "Select desired result:"
  12. 210 PRINT
  13. 220 PRINT "1 - Current Value"
  14. 230 PRINT "2 - Rate of Return"
  15. 240 PRINT "3 - Future Value"
  16. 250 PRINT
  17. 260 INPUT "Result number: ", RESULT
  18. 270 IF RESULT < 1 OR RESULT > 3  THEN PRINT "Select 1-3 only" : GOTO 210
  19. 280 PRINT
  20. 290 '     Let user enter data
  21. 300 PRINT "Do not enter dollar signs or commas"
  22. 310 PRINT
  23. 320 IF RESULT <> 1  THEN INPUT "Purchase price: ", PV
  24. 330 IF RESULT <> 2  THEN INPUT "Annual rate of return (in percent): ", AR
  25. 340 IF RESULT <> 3  THEN INPUT "Value at end of term: ", FV
  26. 350 INPUT "Number of periods: ", NPERIODS
  27. 360 INPUT "Number of periods per year: ", NPY
  28. 370 '     Compute periodic interest rate
  29. 380 PR = (1 + AR / 100) ^ (1 / NPY) - 1
  30. 390 ON RESULT GOTO 410,460,520
  31. 400 '     Result 1: Find current value
  32. 410 PV = FV * (1 + PR) ^ -NPERIODS
  33. 420 PRINT
  34. 430 PRINT "Current Value: "; USING MONEYFMT$; PV
  35. 440 END
  36. 450 '     Result 2: Find rate of return
  37. 460 PR = (FV / PV) ^ (1 / NPERIODS) - 1
  38. 470 AR = ((1 + PR) ^ NPY - 1) * 100
  39. 480 PRINT
  40. 490 PRINT "Annual rate of return: "; FNR(AR);"%"
  41. 500 END
  42. 510 '     Result 3: Find future value of investment
  43. 520 FV = PV * (1 + PR) ^ NPERIODS
  44. 530 PRINT
  45. 540 PRINT "Future value: "; USING MONEYFMT$; FV
  46. 550 END
  47.